package cn.yuli.pizza;

import cn.yuli.ingredient.PizzaIngredientFactory;
import cn.yuli.ingredient.item.Dough;
import cn.yuli.ingredient.item.Sauce;
import cn.yuli.ingredient.item.Toppings;

/**
 * 工厂模式：披萨抽象类
 * @author yuli
 *
 */
public abstract class Pizza {
	protected String name;//披萨名称
	protected Dough dough;//披萨面团
	protected Sauce sauce;//披萨酱料
	protected Toppings toppings;//披萨佐料
	
	public Pizza(String name,PizzaIngredientFactory pizzaIngredientFactory) {
		super();
		this.name = name;
		this.dough = pizzaIngredientFactory.createDough();
		this.sauce = pizzaIngredientFactory.createSuace();
		this.toppings = pizzaIngredientFactory.createToppings();
	}
	public void prepare(){
		System.out.println("正在准备：" + name);
		System.out.println("正在揉面团：" + dough);
		System.out.println("正在加上酱料：" + sauce);
		for (String string : toppings.getToppings()) {
			System.out.println("正在撒上配料：" + string);
		}
	}
	/**
	 * 烘烤方法
	 */
	public void bake(){
		System.out.println("正在烘烤披萨...需要30分钟...");
	}
	/**
	 * 裁剪方法
	 */
	public void cut(){
		System.out.println("正在裁剪披萨...分成8份...");
	}
	public void box(){
		System.out.println("正在包装披萨...绿色盒子...");
	}
	public String getName(){
		return name;
	}
	@Override
	public String toString() {
		return "这是一个"+name;
	}
}
